package lanqiao;
/**
 * @Project : ProgrammingExercises
 * @Package : LanQiao.PrepareForCompetition
 * @File : Q0126.java
 * @Author : WangRuoyu
 * @Date : 2023/3/19 10:53
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Q0126 {
    static boolean[] st;

    public static void main(String[] args) throws IOException, IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] words = br.readLine().split(" ");

        int n = Integer.parseInt(words[0]);

        int[] d = new int[n + 1];
        st = new boolean[n + 1];

        words = br.readLine().split(" ");
        for (int i = 1; i <= n; ++i) {
            d[i] = Integer.parseInt(words[i - 1]);
        }

        int k = 0;

        for (int i = 1; i <= n; ++i) {
            if (!st[i]) {
                k++;
                while (!st[i]) {
                    st[i] = true;
                    i = d[i];
                }
            }
        }

        System.out.println(n - k);
    }
}

